pub fn read_packages(&self) -> CargoResult<Vec<Package>> {
if self.updated {
Ok(self.packages.clone())
- } else if self.id.is_path() && self.id.precise().is_some() {
+ } else if (self.id.is_path() && self.id.precise().is_some()) ||
+ self.id.is_registry() {
// If our source id is a path and it's listed with a precise
// version, then it means that we're not allowed to have nested
- // dependencies (they've been rewritten to crates.io dependencies)
- // In this case we specifically read just one package, not a list of
- // packages.
+ // dependencies (they've been rewritten to crates.io dependencies).
+ //
+ // If our source id is a registry dependency then crates are
+ // published one at a time so we don't recurse as well. Note that
+ // cargo by default doesn't package up nested dependencies but it
+ // may do so for custom-crafted tarballs.
+ //
+ // In these cases we specifically read just one package, not a list
+ // of packages.
let path = self.path.join("Cargo.toml");
let (pkg, _) = try!(ops::read_package(&path, &self.id,
self.config));
.with_stdout_contains(format!("\
{compiling} foo v0.5.0 ([..])", compiling = COMPILING)));
});
+
+test!(bundled_crate_in_registry {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.5.0"
+ authors = []
+
+ [dependencies]
+ bar = "0.1"
+ baz = "0.1"
+ "#)
+ .file("src/main.rs", "fn main() {}");
+ p.build();
+
+ Package::new("bar", "0.1.0").publish();
+ Package::new("baz", "0.1.0")
+ .dep("bar", "0.1.0")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "baz"
+ version = "0.1.0"
+ authors = []
+
+ [dependencies]
+ bar = { path = "bar", version = "0.1.0" }
+ "#)
+ .file("src/lib.rs", "")
+ .file("bar/Cargo.toml", r#"
+ [package]
+ name = "bar"
+ version = "0.1.0"
+ authors = []
+ "#)
+ .file("bar/src/lib.rs", "")
+ .publish();
+
+ assert_that(p.cargo("run"), execs().with_status(0));
+});